package com.woniu.adapter;

import com.woniu.outlet.client.WorkingProcedures;
import com.woniu.outlet.dao.ProgressMapper;
import com.woniu.outlet.po.Progress;
import com.woniu.outlet.po.ProgressExample;
import com.woniu.outlet.redis.ERPRedisRepo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class ProgressAdapter {
    @Autowired
    private ProgressMapper progressMapper;
    @Autowired
    private WorkingProcedures workingProcedures;

    public void addProgress (Progress progress) {
        progress.setProductionTotal(Integer.parseInt(progress.getSpare1())+progress.getRepairNum()+progress.getGoodProNum()+progress.getScrapNum());
        progressMapper.insertSelective(progress);
        workingProcedures.addSystemLog("添加项目进度");
    }


    public void passiveUser(Long proPlanId,Integer processId,Integer userId){
        Progress progress = new Progress();
        progress.setPassiveUserId(userId);

//        ProgressExample progressExample = new ProgressExample();
//        ProgressExample.Criteria criteria = progressExample.createCriteria();
//        criteria.andProPlanIdEqualTo(proPlanId);
//        criteria.andProcessIdEqualTo(processId.longValue());
//        progressMapper.updateByExampleSelective(progress,progressExample);
//        workingProcedures.addSystemLog("报工添加项目进度");
    }


}
